<HTML><HEAD><TITLE>exit_block(++TagExit)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">Control</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>exit_block(++TagExit)</H1>
Continues the program at the recovery procedure of the block/3 predicate
whose Tag argument unifies with TagExit.


<DL>
<DT><EM>TagExit</EM></DT>
<DD>An atom, integer or handle.
</DD>
</DL>
<H2>Description</H2>
   Can only occur after block(Goal,Tag, Recovery) has been invoked.  First
   Goal is called and if this succeeds then block/3 succeeds.  If Goal
   fails then so does the call of block/3.  If, however, during the
   execution of Goal there is a call of exit_block(TagExit) such that Tag
   unifies with TagExit, then block/3 calls the goal Recovery, and succeeds
   or fails according to whether Recovery succeeds or fails.  If Tag does
   not unify with TagExit, the system continues looking for an earlier
   invocation of block/3.
<P>
   If no block/3 catches the exit, then control will either return to the
   host program (in case of an embedded ECLiPSe) or the ECLiPSe process
   will exit (in case of a standalone ECLiPSe).
<P>

<H3>Modes and Determinism</H3><UL>
<LI>exit_block(++) is erroneous
</UL>
<H3>Exceptions</H3>
<DL>
<DT><EM>(4) instantiation fault </EM>
<DD>TagExit is uninstantiated.
<DT><EM>(5) type error </EM>
<DD>TagExit is instantiated but not to an atom, integer or handle.
<DT><EM>(230) uncaught exception </EM>
<DD>TagExit does not unify with a Tag of any uncompleted call of block/3.
</DL>
<H2>Examples</H2>
<PRE>
      % A variable Tag catches all exit_blocks
      ?- block(exit_block(hello), T, writeln(recover(T))).
      recover(hello)
      T = hello
      Yes (0.00s cpu)

      % An instantiated Tag catches only matching exit_blocks
      ?- block(exit_block(hello), hello, writeln(recovered)).
      recovered
      Yes (0.00s cpu)

      ?- block(exit_block(hello), world, writeln(recovered)).
      uncaught exception in exit_block(hello)
      Abort


Error:
      exit_block("a").                (Error 5).
      exit_block(a).                  (Error 230).
</PRE>
<H2>See Also</H2>
<A HREF="../../kernel/control/block-3.html">block / 3</A>
</BODY></HTML>
